import { Injectable } from '@angular/core';
import {RequestUtil} from "../../../../util/request-util";
import {Observable} from "rxjs/Observable";
import {DamAPI} from "../../peach-constants";
import {MsgResult} from "../../../../models/msg-result";

@Injectable()
export class WxgridService {

  constructor(
    private requestUtil: RequestUtil
  ) { }

  getMapSiteData(pointType):Observable<MsgResult>{
    let params = "format=json&pointType="+pointType;
    return this.requestUtil.get(DamAPI.mapSiteInfo,params);
  }
  getMapGridData(level,regionName):Observable<MsgResult>{
    let params = "format=json&level="+level+"&regionName="+regionName;
    return this.requestUtil.get(DamAPI.mapGridInfo,params);
  }
  getMapGridDetailData(regionCode):Observable<MsgResult>{
    let params = "format=json&regionCode="+regionCode;
    return this.requestUtil.get(DamAPI.mapGridDetailInfo,params);
  }
  getTrackDeviceList(deviceType):Observable<MsgResult>{
    let params = "format=json&deviceType="+deviceType;
    return this.requestUtil.get(DamAPI.trackDeviceList,params);
  }
  getTrackDeviceData(deviceCode,searchDate):Observable<MsgResult>{
    let params = "format=json&deviceCode="+deviceCode+"&startTime="+searchDate+" 00:00:00"+"&endTime="+searchDate+" 23:59:59";
    return this.requestUtil.get(DamAPI.trackDeviceData,params);
  }
  getGridEnterprise():Observable<MsgResult>{
    let params = "format=json";
    return this.requestUtil.get(DamAPI.gridEnterprise,params);
  }
}
